package me.zhengjie.modules.system.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum TokenTypeToPathEnum {
    BASE_PATH("基本路径", "", "http://121.89.222.153:38660"),
    TOKEN_PATH("TOKEN路径", "", "/api/acq-channel-gateway/v1/acq-channel-auth-service/tokens/token"),

    SMALL_MERCHANT_ACCESS_PATH("小微商户入网", "4001", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/apply"),
    MERCHANT_TERMINAL_BIND_PATH("商户终端绑定", "4002", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/term/bind"),
    MERCHANT_TERMINAL_UN_BIND_PATH("商户终端解绑", "4003", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/term/unbind"),
    QUERY_MERCHANT_TERMINAL_PATH("商户终端查询", "4004", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/term/query"),
    QUERY_MERCHANT_BASE_INFO_PATH("商户基本信息查询", "4005", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/info/query"),
    QUERY_MERCHANT_TATE_INFO_PATH("商户费率信息查询", "4006", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/fee/query"),
    QUERY_MERCHANT_SETTLEMENT_INFO_PATH("商户结算信息查询", "4007", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/account/query"),
    SMALL_MERCHANT_BASE_INFO_UPDATE_PATH("小微商户基本信息修改", "4008", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/info/update"),
    SMALL_MERCHANT_RATE_INFO_UPDATE_PATH("小微商户费率信息修改", "4009", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/fee/update"),
    SMALL_MERCHANT_SETTLEMENT_INFO_UPDATE_PATH("小微商户结算信息修改", "4010", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/account/update"),

    BUSINESS_MERCHANT_NET_WORK_ACCESS_PATH("企业/个体户商户入网", "5001", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/merchLevel/apply"),
    BUSINESS_MERCHANT_BASE_INFO_UPDATE_PATH("企业/个体户商户基本信息修改", "5002", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/info/level/update"),
    BUSINESS_MERCHANT_SETTLEMENT_INFO_UPDATE_PATH("企业/个体户商户结算信息修改", "5003", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/account/level/update"),

    MERCHANT_MERGE_WITHDRAWAL_QUERY_PATH("商户合并提现标识查询", "4011", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/combined/query"),
    MERCHANT_MERGE_WITHDRAWAL_UPDATE_PATH("商户合并提现标识更新", "4012", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/combined/update"),
    MERCHANT_WALLET_QUERY_PATH("商户钱包余额查询", "4013", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/wallet/balance"),
    MERCHANT_WITHDRAWALS_LIST_QUERY_PATH("商户待提现列表查询", "4014", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/withdraw/query"),
    MERCHANT_MERGER_WITHDRAWAL_APPLICATION_PATH("商户合并提现申请", "4015", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/withdraw/apply"),
    MERCHANT_WITHDRAWAL_QUERY_PATH("商户合并提现结果查询", "4016", "/api/acq-channel-gateway/v1/acq-channel-service/agent/expand/merch/withdraw/apply/query"),


    QUERY_PROVINCE_PATH("查询地区(省)", "3001", "/api/acq-channel-gateway/v1/acq-channel-service/agent/common/province"),
    QUERY_CITY_PATH("查询地区(市)", "3002", "/api/acq-channel-gateway/v1/acq-channel-service/agent/common/city"),
    QUERY_COUNTY_PATH("查询地区(区县)", "3003", "/api/acq-channel-gateway/v1/acq-channel-service/agent/common/county"),
    QUERY_BANK_PATH("查询银行卡行号和银行名称)", "3011", "/api/acq-channel-gateway/v1/acq-channel-service/agent/common/bank"),

    ;

    @JsonValue
    @EnumValue
    private final String name;
    private final String tokenType;
    private final String path;

    public static TokenTypeToPathEnum findOne(String tokenType) {
        return Arrays.stream(TokenTypeToPathEnum.values())
                .filter(type -> type.getTokenType().equals(tokenType)).findAny().orElse(null);
    }
}
